#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
配置文件 - 存储应用程序的各种设置
"""

# 应用程序信息
APP_NAME = "MP4视频压缩工具"
APP_VERSION = "1.0.0"
APP_AUTHOR = "AI助手"

# 支持的文件格式
SUPPORTED_FORMATS = [".mp4", ".MP4"]

# 压缩预设配置
COMPRESSION_PRESETS = {
    "ultra_fast": {
        "name": "极速压缩",
        "description": "最快速度，适合大文件快速压缩",
        "crf": 30,
        "preset": "ultrafast",
        "threads": 0,  # 使用所有CPU核心
        "tune": "fastdecode"
    },
    "fast_quality": {
        "name": "快速高质量",
        "description": "速度和质量的最佳平衡",
        "crf": 25,
        "preset": "veryfast",
        "threads": 0,
        "tune": None
    },
    "high_quality": {
        "name": "高质量",
        "description": "保持较高画质，文件大小适中",
        "crf": 23,
        "preset": "fast",
        "threads": 0,
        "tune": None
    },
    "medium_quality": {
        "name": "中等质量",
        "description": "平衡画质和文件大小",
        "crf": 28,
        "preset": "fast",
        "threads": 0,
        "tune": None
    },
    "small_file": {
        "name": "小文件",
        "description": "最小文件大小，画质较低",
        "crf": 35,
        "preset": "veryfast",
        "threads": 0,
        "tune": None
    }
}

# 默认设置
DEFAULT_OUTPUT_SUFFIX = "_compressed"
DEFAULT_PRESET = "fast_quality"

# 性能优化设置
PERFORMANCE_SETTINGS = {
    "enable_hardware_acceleration": True,  # 启用硬件加速
    "max_cpu_usage": 80,  # 最大CPU使用率（百分比）
    "thread_priority": "normal",  # 线程优先级：low, normal, high
    "memory_limit_mb": 2048,  # 内存使用限制（MB）
    "enable_gpu_acceleration": True,  # 启用GPU加速（如果可用）
}

# 硬件加速编码器优先级（按性能排序）
HARDWARE_ENCODERS = [
    "h264_nvenc",    # NVIDIA GPU
    "h264_amf",      # AMD GPU
    "h264_qsv",      # Intel Quick Sync
    "libx264"        # CPU编码（备选）
]

# GPU加速设置
GPU_ACCELERATION = {
    "nvidia": {
        "encoder": "h264_nvenc",
        "decoder": "h264_cuvid",
        "preset": "p4",  # NVIDIA预设：p1(fastest) - p7(slowest)
        "tune": "hq"     # 高质量调优
    },
    "amd": {
        "encoder": "h264_amf",
        "preset": "speed",
        "quality": "balanced"
    },
    "intel": {
        "encoder": "h264_qsv",
        "preset": "veryfast",
        "look_ahead": 1
    }
}

# GUI设置
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 600
WINDOW_TITLE = f"{APP_NAME} v{APP_VERSION}"
